﻿using Core.DomainServices;
using Infrastructure.ApplicationServices;
using Infrastructure.DomainServices.Hdiphone6wallpaper;
using Infrastructure.DomainServices.Iphonewalls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure.DomainServices
{
    public class BatchProcess : IBatchProcess
    {
        public void RunAll()
        {

            var config = new Config();
            IList<ICategoryCrawlable> items = new List<ICategoryCrawlable>()
            {
                new WebsiteHdiphone6wallpaper(new Hdiphone6wallpaperCrawable(config), config, new FileWriter(config)),
                new WebsiteIphonewalls(new IphonewallsCrawable(config), config, new FileWriter(config)),
                
            };

            Parallel.ForEach<ICategoryCrawlable>(items, item => item.Parser(item.GetCategories));
        }
    }
}
